home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / fopenp.c < prev    next >
C/C++ Source or Header  |  1994-01-15  |  482b  |  25 lines

  1. /* open a file, searching along the PATH environment variable for it */
  2.  
  3. /* rehacked by Uwe Ohse, 3.5.93: uses buffindfile now */
  4.  
  5. #include <stdio.h>
  6. #include <errno.h>
  7. #include <stdlib.h>
  8. #include <limits.h>
  9. #include <support.h>
  10.  
  11. FILE *
  12. fopenp(name, mode)
  13.     const char *name, *mode;
  14. {
  15.     char *fullname;
  16.     char buffer[PATH_MAX];
  17.  
  18.     fullname = _buffindfile(name, getenv("PATH"), (char **)0, buffer);
  19.     if (!fullname) {
  20.         errno = ENOENT;
  21.         return NULL;
  22.     }
  23.     return fopen(fullname, mode);
  24. }
  25.